package com.jeegit.ecms.service.impl;

import java.util.List;
import com.jeegit.common.utils.DateUtils;
import com.jeegit.common.utils.IdUtils;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.jeegit.ecms.mapper.CmsBannersMapper;
import com.jeegit.ecms.domain.CmsBanners;
import com.jeegit.ecms.service.ICmsBannersService;
import com.jeegit.common.core.text.Convert;

/**
 * 首页横幅Service业务层处理
 * 
 * @author jeegit
 * @date 2022-07-05
 */
@Service
public class CmsBannersServiceImpl implements ICmsBannersService 
{
    @Autowired
    private CmsBannersMapper cmsBannersMapper;

    /**
     * 查询首页横幅
     * 
     * @param id 首页横幅主键
     * @return 首页横幅
     */
    @Override
    public CmsBanners selectCmsBannersById(String id)
    {
        return cmsBannersMapper.selectCmsBannersById(id);
    }

    /**
     * 查询首页横幅列表
     * 
     * @param cmsBanners 首页横幅
     * @return 首页横幅
     */
    @Override
    public List<CmsBanners> selectCmsBannersList(CmsBanners cmsBanners)
    {
        return cmsBannersMapper.selectCmsBannersList(cmsBanners);
    }

    /**
     * 新增首页横幅
     * 
     * @param cmsBanners 首页横幅
     * @return 结果
     */
    @Override
    public int insertCmsBanners(CmsBanners cmsBanners)
    {
    	cmsBanners.setId(IdUtils.getInstance(3l).nextId());
    	cmsBanners.preInsert(cmsBanners);
    	return cmsBannersMapper.insertCmsBanners(cmsBanners);
    }

    /**
     * 修改首页横幅
     * 
     * @param cmsBanners 首页横幅
     * @return 结果
     */
    @Override
    public int updateCmsBanners(CmsBanners cmsBanners)
    {
    	cmsBanners.preUpdate(cmsBanners);
    	return cmsBannersMapper.updateCmsBanners(cmsBanners);
    }

    /**
     * 批量删除首页横幅
     * 
     * @param ids 需要删除的首页横幅主键
     * @return 结果
     */
    @Override
    public int deleteCmsBannersByIds(String ids)
    {
        return cmsBannersMapper.deleteCmsBannersByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除首页横幅信息
     * 
     * @param id 首页横幅主键
     * @return 结果
     */
    @Override
    public int deleteCmsBannersById(String id)
    {
        return cmsBannersMapper.deleteCmsBannersById(id);
    }
}
